/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: XMQ
 * Date: 2022-05-12
 * Time: 22:14
 */
//继承
class Base{
    public int a = 1;
    public int b = 2;

    public void func(){
        System.out.println("这是Base的方法!");
    }
}
class Derived extends Base{
    public int a = 11;
    public int b = 22;
    public int c = 3;

    public void func1(){
        System.out.println("这是Derived的方法!");
    }
    public void func(){
        System.out.println("这是Derived中和Base重名的方法!");
    }
    public void test(){
        //super.属性
        //super.func()方法
        System.out.println(a);
        System.out.println("这是父类的a:"+super.a);
        System.out.println(b);
        System.out.println("这是父类的b:"+super.b);
        System.out.println(c);
        this.func1();
        this.func();
        super.func();
    }
}
public class Test {
    public static void main(String[] args) {
        Derived d = new Derived();
        d.test();

    }
}
